package com.foxitcloud.webpdf.common;

/**
 * @author yxs Cache description handle.
 */
public class CacheDescriptionHandle {

	/**
	 * @param isForm 是否是表单模式
	 * @return description of manifest cache item.
	 */
	public static String getManifestInfoCacheDescription(boolean isForm, boolean isTrail) {
		String description = "";
		if(!isForm){
			description = CacheDescription.ManifestInfo;
		}
		else{
			description = CacheDescription.ManifestInfo + "_form";
		}
		
		if(isTrail){
			description += "_trail";
		}
		return description;
	}

	/**
	 * @return description of annotation cache item.
	 */
	public static String getAnnnosCacheDescription(boolean isTrail) {
		return CacheDescription.AnnotationInfo;
	}

	/**
	 * @return description of bookmark cache item.
	 */
	public static String getBookmarksCacheDescription(boolean isTrail) {
		return CacheDescription.BookmarkInfo;
	}

	/**
	 * @param pageIndex
	 *            page index.
	 * @param fZoom
	 *            zoom of page.
	 * @param isForm
	 *            whether the PDF file is a form.
	 * @return description of page image cache item.
	 */
	public static String getPageImageCacheDescription(int pageIndex,
			float fZoom, boolean isForm,boolean isTrail) {
		String description = String.format(CacheDescription.PageImage,
				pageIndex, (int) (fZoom * 100), isForm ? 1 : 0);
		description += isTrail ? "_trail" : "";
				
		return description;
	}

	/**
	 * @param pageIndex
	 *            page index.
	 * @return description of page text cache item.
	 */
	public static String getPageTextCacheDescription(int pageIndex,boolean isTrail) {
		String description = String
				.format(CacheDescription.TextInfo, pageIndex);
		return description;
	}

	/**
	 * @param pageIndex
	 *            page index
	 * @return description of form image cache item.
	 */
	public static String getFormImageCacheDescription(int pageIndex,boolean isTrail) {
		String description = String.format(CacheDescription.FormImage,
				pageIndex);
		return description;
	}

	/**
	 * @param pageIndex
	 *            page index.
	 * @return description of page xml information cache item.
	 */
	public static String getFormXmlInfoCacheDescription(int pageIndex,boolean isTrail) {
		String description = String.format(CacheDescription.FormXmlInfo,
				pageIndex);
		return description;
	}
	
	public static String getPdfTextCacheDescription(){
		String description = CacheDescription.PdfTextInfo;
		return description;
	}
}
